package com.shenqi.parking.mapper;

import java.util.List;
import com.shenqi.parking.domain.ParkingApply;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 租赁意向Mapper接口
 * 
 * @author shenqi
 * @date 2025-07-27
 */
public interface ParkingApplyMapper 
{
    /**
     * 查收我收到的意向
     * @return
     */
    List<ParkingApply> selectParkingReceivedApplyList(String creatorUsername);

    /**
     * 查询租赁意向
     * 
     * @param id 租赁意向主键
     * @return 租赁意向
     */
    public ParkingApply selectParkingApplyById(Long id);

    /**
     * 查询租赁意向列表
     * 
     * @param parkingApply 租赁意向
     * @return 租赁意向集合
     */
    public List<ParkingApply> selectParkingApplyList(ParkingApply parkingApply);

    /**
     * 新增租赁意向
     * 
     * @param parkingApply 租赁意向
     * @return 结果
     */
    public int insertParkingApply(ParkingApply parkingApply);

    /**
     * 修改租赁意向
     * 
     * @param parkingApply 租赁意向
     * @return 结果
     */
    public int updateParkingApply(ParkingApply parkingApply);

    /**
     * 删除租赁意向
     * 
     * @param id 租赁意向主键
     * @return 结果
     */
    public int deleteParkingApplyById(Long id);

    /**
     * 批量删除租赁意向
     * 
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteParkingApplyByIds(Long[] ids);


    @Select("SELECT COUNT(*) FROM parking_apply WHERE id = #{id} AND create_by = #{ownerUsername}")
    boolean existsByIdAndOwner(@Param("id") Long id, @Param("ownerUsername") String ownerUsername);
}
